package com.financing.wap.dao.impl;
 

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

 






import com.financing.wap.common.SqlName;
import com.financing.wap.dao.IAnswerDao;
import com.financing.wap.dto.ActivitesAnswerDTO;
import com.financing.wap.dto.ActivitesMoneyDTO;



@Repository("answerDao")
public class AnswerDaoImpl extends BaseDaoImpl<ActivitesAnswerDTO, java.lang.Integer> implements IAnswerDao {

	@Override
	public List<ActivitesAnswerDTO> searchAnswerByParas(ActivitesAnswerDTO queryDto) {
		List<ActivitesAnswerDTO> result = this.getSqlMapClientTemplate().queryForList(SqlName.ANSWER_SEARCH_SESSIONID,queryDto);
		return result;
	}

	@Override
	public int updateAnswerBySessionId(ActivitesAnswerDTO dto) {
		this.sqlMapClientTemplate.update(SqlName.ANSWER_UPDATE_SESSIONID,dto);
		return 1;
	}

	@Override
	public int insertAnswer(ActivitesAnswerDTO dto) {
		this.getSqlMapClientTemplate().insert(SqlName.ANSWER_INSERT,dto);
		return 0;
	}

	@Override
	public Class<ActivitesAnswerDTO> getEntityClass() {
	 
		return ActivitesAnswerDTO.class;
	}

	@Override
	public Integer searchCountOneWeek(Map<String, Date> p) {
		@SuppressWarnings("deprecation")
		Integer c = (Integer)this.getSqlMapClientTemplate().queryForObject(SqlName.ANSWER_SEARCH_COUNT_ONE_WEEK,p);
		return c;
	}
 
	@Override
	public List<ActivitesMoneyDTO> searchAnswerResultTop(Integer top) {
		List<ActivitesMoneyDTO> result = this.getSqlMapClientTemplate().queryForList(SqlName.ANSWER_SEARCH_RESULT_TOP,top);
		return result;
	}

	@Override
	public Integer searchAnswerRanking(Integer answer) {
		Integer c = (Integer)this.getSqlMapClientTemplate().queryForObject(SqlName.ANSWER_MONEY_ANSWER_RANKING,answer);
		return c;
	}

	@Override
	public Integer searchMoneyCount() {
		Integer c = (Integer)this.getSqlMapClientTemplate().queryForObject(SqlName.ANSWER_MONEY_JOIN_COUNT);
		return c;
	}
	
	
	
}
